Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bake: discard progress on print #2079

Closed

Conversation

crazy-max
Copy link
Member

follow-up #2076 (comment)

There are cases when using the canonical representation through --print can be useful but when using a remote bake definition, the output can be used effectively:

$ docker buildx bake https://github.com/docker/buildx.git --print
#0 building with "default" instance using docker driver

#1 [internal] load remote bake definitions
#1 reading docker-bake.hcl done
#1 DONE 1.0s

#2 [internal] load git source https://github.com/docker/buildx.git
#2 0.553 ref: refs/heads/master HEAD
#2 0.553 05b88216251d20597e6a457f0d454dbbeb8d03eb       HEAD
#2 1.014 05b88216251d20597e6a457f0d454dbbeb8d03eb       refs/heads/master
#2 CACHED
{
  "group": {
    "default": {
      "targets": [
        "binaries"
      ]
    }
  },
  "target": {
    "binaries": {
      "context": "https://github.com/docker/buildx.git",
      "dockerfile": "Dockerfile",
      "args": {
        "BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1"
      },
      "target": "binaries",
      "platforms": [
        "local"
      ],
      "output": [
        "./bin/build"
      ]
    }
  }
}

The progress output is still useful here so user knows what ref is being fetched. User could set --progress=quiet to solve this issue.

Tbf I'm not really sure that enforcing quiet is the right solution. Maybe it's just a matter of documenting this use case (cc @dvdksn)? Let me know what you think.

@dvdksn
Copy link
Contributor

dvdksn commented Oct 14, 2023

I think I agree that having the progress output can be very useful. What are the cases when the new progress change could break things? I tried running the example in #2076 but it seems to work fine for me

$ echo "matrix=$(./bin/build/buildx bake binaries-cross --print | jq -cr '.target."binaries-cross".platforms')"
[+] Building 0.0s (1/1) FINISHED                                                                  
 => [internal] load local bake definitions                                                   0.0s
 => => reading docker-bake.hcl 3.68kB / 3.68kB                                               0.0s
matrix=["darwin/amd64","darwin/arm64","linux/amd64","linux/arm/v6","linux/arm/v7","linux/arm64","linux/ppc64le","linux/riscv64","linux/s390x","windows/amd64","windows/arm64"]

At first I thought this could be solved by supress stderr (buildx bake --print 2> /dev/null | jq), but not sure it's necessary given the above.

@crazy-max
Copy link
Member Author

I tried running the example in #2076 but it seems to work fine for me

Ah right pipe redirects stdout to jq so not an issue after all, thanks for making sure @dvdksn!

I was thinking of other cases where users redirect both (&>) programmatically but that's out of scope.

@crazy-max crazy-max closed this Oct 15, 2023
@crazy-max crazy-max deleted the bake-discard-progress-print branch October 15, 2023 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants